export default {
  namespaced: true,
  state: {
    checkedTool: {
      name: "",
      sleeping: false
    },
    menuVisible: false,
    drawTool: ""
  },
  mutations: {
    // 左侧菜单
    selectTool(state, name) {
      if (name == "sleeping" || state.checkedTool.name == name) {
        state.checkedTool.sleeping = true;
        setTimeout(() => {
          state.checkedTool.name = "";
          state.checkedTool.sleeping = false;
        }, 500);
      } else {
        state.checkedTool.name = name;
      }
    },
    // 菜单
    toggleMenu(state) {
      state.menuVisible = !state.menuVisible;
    },
    changeTool(state, value) {
      state.drawTool = value;
    }
  }
}